import 'package:bruno/bruno.dart';
import 'package:common/common.dart';
import 'package:common/image/image_tools.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../theme/font.dart';

/// @description:
/// @author
/// @date: 2025-01-21 14:28:41
class BlackListPage extends StatelessWidget {
  const BlackListPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BrnAppBar(title: '黑名单', backgroundColor: Colors.white),
      backgroundColor: Colors.white,
      body: ListView.separated(
        itemBuilder: (BuildContext context, int index) {
          return _buildItem(
              name: '',
              image: '',
              sex: index % 1,
              action: () {
                SmartDialog.show(
                  usePenetrate: false,
                  clickMaskDismiss: true,
                  backType: SmartBackType.block,
                  keepSingle: true,
                  useAnimation: false,
                  builder: (context) => Center(
                    child: CustomAlertWidget(
                      title: '温馨提示',
                      content: "确认将Ta移出黑名单吗？\n",
                      confirmText: '确定',
                      confirmAction: () {},
                      cancemText: '取消',
                    ),
                  ),
                );
              });
        },
        separatorBuilder: (BuildContext context, int index) {
          return Divider(height: 0.5, color: const Color(0xFFEEEEEE).withOpacity(0), indent: 15, endIndent: 15);
        },
        itemCount: 10,
      ),
    );
  }

  Widget _buildItem({required String image, required String name, required int sex, VoidCallback? action}) {
    return Container(
      color: Colors.white,
      padding: const EdgeInsets.symmetric(horizontal: 16),
      child: Column(
        children: [
          Container(
            padding: const EdgeInsets.symmetric(vertical: 10),
            child: Row(
              children: [
                ImageView(
                    url: 'https://img.zcool.cn/community/01fd6e5821a7c1a84a0e282ba9dbf4.gif',
                    width: 50.w,
                    height: 50.w,
                    fit: BoxFit.cover,
                    type: ImageViewType.avater,
                    shape: BoxShape.circle),
                const SizedBox(width: 10),
                Text('喵喵小姐',
                    style:
                        TextStyle(color: const Color(0xFF333333), fontSize: 16.sp, fontWeight: AppFontWeight.medium)),
                const SizedBox(width: 5),
                Padding(
                  padding: const EdgeInsets.only(right: 10),
                  child: sex == 1
                      ? Image.asset('assets/app/images/world/user_sex_girl.png', height: 18.h)
                      : Image.asset('assets/app/images/world/user_sex_boy.png', height: 18.h),
                ),
                const Spacer(),
                Container(
                  height: 26.h,
                  child: BrnSmallOutlineButton(
                    title: '解除',
                    width: 60.w,
                    radius: 22.r,
                    fontSize: 12.sp,
                    fontWeight: FontWeight.w400,
                    lineColor: const Color(0xFF25D4D0),
                    textColor: const Color(0xFF25D4D0),
                    insertPadding: EdgeInsets.zero,
                    themeData: BrnButtonConfig(smallButtonHeight: 26.h),
                    onTap: () {
                      action?.call();
                    },
                  ),
                ),
              ],
            ),
          ),
          const Divider(color: Color(0xFFEEEEEE), height: 0.5, indent: 15, endIndent: 15)
        ],
      ),
    );
  }
}
